﻿#include "DataPolarCoordinate.h"

namespace pst
{
    DataPolarCoordinate::DataPolarCoordinate(QObject* parent)
        : QObject(parent)
        , m_angleAxisDisplay(new Style2D_Axis)
        , m_angleAxisRange(new Style2D_AxisRange)
        , m_radiusAxisDisplay(new Style2D_Axis)
        , m_radiusAxisRange(new Style2D_AxisRange)
        , m_grid(new Style2D_GridLine)
        , m_title(new Style2D_Title)
        , m_legend(new Style2D_Legend)
        , m_dataProperty(new Style2D_DataProperty)
    {
    }

    DataPolarCoordinate::~DataPolarCoordinate()
    {
        if (m_angleAxisDisplay)
        {
            delete m_angleAxisDisplay;
            m_angleAxisDisplay = nullptr;
        }
        if (m_angleAxisRange)
        {
            delete m_angleAxisRange;
            m_angleAxisRange = nullptr;
        }
        if (m_radiusAxisDisplay)
        {
            delete m_radiusAxisDisplay;
            m_radiusAxisDisplay = nullptr;
        }
        if (m_radiusAxisRange)
        {
            delete m_radiusAxisRange;
            m_radiusAxisRange = nullptr;
        }
        if (m_grid)
        {
            delete m_grid;
            m_grid = nullptr;
        }
        if (m_title)
        {
            delete m_title;
            m_title = nullptr;
        }
        if (m_legend)
        {
            delete m_legend;
            m_legend = nullptr;
        }
        if (m_dataProperty)
        {
            delete m_dataProperty;
            m_dataProperty = nullptr;
        }
    }

    void DataPolarCoordinate::copyData(const DataPolarCoordinate* data)
    {
        if (this == data || data == nullptr) return;
        this->m_angleAxisDisplay->copyData(data->m_angleAxisDisplay);
        this->m_angleAxisRange->copyData(data->m_angleAxisRange);
        this->m_radiusAxisDisplay->copyData(data->m_radiusAxisDisplay);
        this->m_radiusAxisRange->copyData(data->m_radiusAxisRange);
        this->m_grid->copyData(data->m_grid);
        this->m_title->copyData(data->m_title);
        this->m_legend->copyData(data->m_legend);
        this->m_dataProperty->copyData(data->m_dataProperty);
    }

    void DataPolarCoordinate::setAngleAxisDisplay(Style2D_Axis* data)
    {
        m_angleAxisDisplay = data;
    }

    Style2D_Axis* DataPolarCoordinate::getAngleAxisDisplay() const
    {
        return m_angleAxisDisplay;
    }

    void DataPolarCoordinate::setAngleAxisRange(Style2D_AxisRange* data)
    {
        m_angleAxisRange = data;
    }

    Style2D_AxisRange* DataPolarCoordinate::getAngleAxisRange() const
    {
        return m_angleAxisRange;
    }

    void DataPolarCoordinate::setRadiusAxisDisplay(Style2D_Axis* data)
    {
        m_radiusAxisDisplay = data;
    }

    Style2D_Axis* DataPolarCoordinate::getRadiusAxisDisplay() const
    {
        return m_radiusAxisDisplay;
    }

    void DataPolarCoordinate::setRadiusAxisRange(Style2D_AxisRange* data)
    {
        m_radiusAxisRange = data;
    }

    Style2D_AxisRange* DataPolarCoordinate::getRadiusAxisRange() const
    {
        return m_radiusAxisRange;
    }

    void DataPolarCoordinate::setGrid(Style2D_GridLine* data)
    {
        m_grid = data;
    }
    Style2D_GridLine* DataPolarCoordinate::getGrid() const
    {
        return m_grid;
    }

    void DataPolarCoordinate::setTitle(Style2D_Title* data)
    {
        m_title = data;
    }

    Style2D_Title* DataPolarCoordinate::getTitle() const
    {
        return m_title;
    }

    void DataPolarCoordinate::setLegend(Style2D_Legend* data)
    {
        m_legend = data;
    }

    Style2D_Legend* DataPolarCoordinate::getLegend() const
    {
        return m_legend;
    }

    void DataPolarCoordinate::setDataProperty(Style2D_DataProperty* data)
    {
        m_dataProperty = data;
    }

    Style2D_DataProperty* DataPolarCoordinate::getDataProperty() const
    {
        return m_dataProperty;
    }



}
